import java.io.Serializable;

/* 
 * Class to use to have a structure of message
 * @attribute:
 * 	type: 0 -> undefined
 * 		  1 -> start game request
 * 		  2 -> server -> client, content the row of dashes or letter, number of attempt left and score
 * 		  3 -> client -> server, guess letter or word
 * 		  4 -> GAME_WON ->message from the serveur to tell the client he has won 
 * 		  5 -> STOP_GAME ->message from the client to tell the server to stop the game
 * 		  6 -> ERROR ->message when an error occurs
 * 		  7 -> GAME_LOST ->message from the serveur when the client has lost the game
 */

public class Message implements Serializable {

	public static final int UNDEF = 0;
	public static final int START_GAME = 1;
	public static final int SERVER_CLIENT = 2;
	public static final int CLIENT_SERVER = 3;
	public static final int GAME_WON = 4;
	public static final int STOP_GAME = 5;
	public static final int ERROR = 6;
	public static final int GAME_LOST = 7;

	private int type;
	private String arg = "vide";
	private int attemptLeft = 1;
	private int score = 0;

	public Message() {
		type = 0;
	}

	public Message(int type) {
		this.type = type;
	}

	public Message(int type, String arg) {
		this.type = type;
		this.arg = arg;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getArg() {
		return arg;
	}

	public void setArg(String arg) {
		this.arg = arg;
	}

	public int getAttemptLeft() {
		return attemptLeft;
	}

	public void setAttemptLeft(int attemptLeft) {
		this.attemptLeft = attemptLeft;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public String toString() {
		String ret = new String("message description: \n " + "Id message : "
				+ type + "\n" + "Contend: " + this.arg + "Score: " + this.score);
		return ret;

	}

}
